home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / SciAn / src / ScianPreInstall.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  19KB  |  848 lines

  1. /*ScianPreInstall.c
  2.   Eric Pepke
  3.   October 10, 1991
  4.   Pre-installation program for SciAn
  5. */
  6.  
  7. #include <stdio.h>
  8. #include <sys/types.h>
  9. #include <sys/stat.h>
  10. #include "machine.h"
  11.  
  12. #if (MACHINE == CRAYYMP) || (MACHINE == CONVEX)
  13. /*fgets doesn't work properly on stdin*/
  14. #define FGETS_IS_SO_STUPID
  15. #endif
  16.  
  17. int fortranP = 0;            /*True iff FORTRAN is linkable*/
  18. int okSoFar = 1;
  19. int warnings = 0;
  20.  
  21. #define MAX(x, y)  ((x) > (y) ? (x) : (y))
  22.  
  23. #define MAXLINE        400
  24. char curLine[MAXLINE + 1];        /*Current line read from console or file*/
  25. char linkLine[MAXLINE + 1];        /*Link flags line*/
  26. char compLine[MAXLINE + 1];        /*Compilation flags line*/
  27. char tempStr[MAXLINE + 1];        /*Temporary string*/
  28. char f77Name[MAXLINE + 1];        /*Name of f77 compiler*/
  29.  
  30. int nAnswers;
  31. int curAnswer;
  32. char **answers;
  33.  
  34. /*File names*/
  35. #define LINKMAKEFILE    "lfiles.make"    /*File containing link flags*/
  36.  
  37. /*Library directories to search*/
  38. char *libDir[] =
  39.     {
  40.     "/lib",
  41.     "/usr/lib",
  42.     "/usr/local/lib"
  43.     };
  44.  
  45. /*Executable directories to search*/
  46. char *exeDir[] =
  47.     {
  48.     ".",
  49.     "/bin",
  50.     "/usr/bin",
  51.     "/usr/local/bin"
  52.     };
  53.  
  54. #define NYESSTRINGS    6
  55.  
  56. /*Strings that count as "yes"*/
  57. char *yesStrings[NYESSTRINGS] =
  58.     {
  59.     "y",
  60.     "yes",
  61.     "yeah",
  62.     "yep",
  63.     "ok",
  64.     "sure"
  65.     };
  66.  
  67. #define NNOSTRINGS    4
  68.  
  69. /*Strings that count as "no"*/
  70. char *noStrings[NNOSTRINGS] = 
  71.     {
  72.     "n",
  73.     "no",
  74.     "nah",
  75.     "nope"
  76.     };
  77.  
  78. void Warning()
  79. /*Prints warning message*/
  80. {
  81.     printf("------------------------------- WARNING -------------------------------\n");
  82.     ++warnings;
  83. }
  84.  
  85. void Danger()
  86. /*Prints danger message*/
  87. {
  88.     printf("******************************* DANGER *******************************\n");
  89.     okSoFar = 0;
  90. }
  91.  
  92. void PrintDontChangeScript(outFile)
  93. FILE *outFile;
  94. /*Prints a don't change warning on script outFile*/
  95. {
  96.     fputs("# This file is produced by ScianPreInstall.c, which is run when you\n", outFile);
  97.     fputs("# do a make INSTALL.  Do not change this file!\n\n", outFile);
  98. }
  99.  
  100. void PrintDontChangeC(outFile)
  101. FILE *outFile;
  102. /*Prints a don't change warning on script outFile*/
  103. {
  104.     fputs("/*This file is produced by ScianPreInstall.c, which is run when you\n", outFile);
  105.     fputs("  do a make INSTALL.  Do not change this file!\n*/\n", outFile);
  106. }
  107.  
  108. int CopyScriptFile(source, dest)
  109. char *source, *dest;
  110. /*Copies a file source to dest; blows up if it can't open output file.  Returns
  111.   0 if it couldn't open source, 1 otherwise.  Side-effect--may set compiler 
  112.   stuff*/
  113. {
  114.     FILE *inFile, *outFile;
  115.  
  116.     inFile = fopen(source, "r");
  117.     outFile = fopen(dest, "w");
  118.     if (!outFile)
  119.     {
  120.     perror(dest);
  121.     exit(-1);
  122.     }
  123.     PrintDontChangeScript(outFile);
  124.     if (inFile)
  125.     {
  126.     while (fgets(curLine, MAXLINE, inFile))
  127.     {
  128.         sscanf(curLine, " F77 = %s\n", f77Name);
  129.         fputs(curLine, outFile);
  130.     }
  131.     fclose(inFile);
  132.     }
  133.     fclose(outFile);
  134.     return inFile ? 1 : 0;
  135. }
  136.  
  137. int CopyCFile(source, dest)
  138. char *source, *dest;
  139. /*Copies a C file source to dest; blows up if it can't open output file.  
  140.   Returns 0 if it couldn't open source, 1 otherwise.  */
  141. {
  142.     FILE *inFile, *outFile;
  143.  
  144.     inFile = fopen(source, "r");
  145.     outFile = fopen(dest, "w");
  146.     if (!outFile)
  147.     {
  148.     perror(dest);
  149.     exit(-1);
  150.     }
  151.     PrintDontChangeC(outFile);
  152.     if (inFile)
  153.     {
  154.     while (fgets(curLine, MAXLINE, inFile))
  155.     {
  156.         fputs(curLine, outFile);
  157.     }
  158.     fclose(inFile);
  159.     }
  160.     fclose(outFile);
  161.     return inFile ? 1 : 0;
  162. }
  163.  
  164. int FindLib(s)
  165. char *s;
  166. /*Returns the directory number iff s is a library that can be found or
  167.   -1 if not*/
  168. {
  169.     int k;
  170.     FILE *temp;
  171.  
  172.     for (k = 0; k < sizeof(libDir) / sizeof(char *); ++k)
  173.     {
  174.     struct stat buf;
  175.  
  176.     sprintf(tempStr, "%s/lib%s.a", libDir[k], s);
  177.     if (stat(tempStr, &buf) == 0)
  178.     {
  179.         return k;
  180.     }
  181.     }
  182.     return -1;
  183. }
  184.  
  185. int FindExe(s)
  186. char *s;
  187. /*Returns 1 iff s is an executable that can be found or
  188.   0 if not*/
  189. {
  190.     int k;
  191.     FILE *temp;
  192.     struct stat buf;
  193.  
  194.     if (stat(s, &buf) == 0)
  195.     {
  196.     return 1;
  197.     }
  198.  
  199.     for (k = 0; k < sizeof(exeDir) / sizeof(char *); ++k)
  200.     {
  201.  
  202.     sprintf(tempStr, "%s/%s", exeDir[k], s);
  203.     if (stat(tempStr, &buf) == 0)
  204.     {
  205.         return 1;
  206.     }
  207.     }
  208.     return 0;
  209. }
  210.  
  211. void AppendLibrary(s)
  212. char *s;
  213. /*Appends library s to group of link files.  May emit warning message if
  214. not found*/
  215. {
  216.     if (FindLib(s) < 0)
  217.     {
  218.     int k;
  219.     Warning();
  220.     printf("Library lib%s.a is not found in ", s);
  221.     for (k = 0; k < sizeof(libDir) / sizeof(char *); ++k)
  222.     {
  223.         if (k == (sizeof(libDir) / sizeof(char *)) - 1)
  224.         {
  225.         printf(", or ");
  226.         }
  227.         else if (k)
  228.         {
  229.         printf(", ");
  230.         }
  231.         printf("%s", libDir[k]);
  232.     }
  233.     printf("\nSciAn will probably not link.\n\n"); 
  234.     }
  235.     sprintf(tempStr, "-l%s ", s);
  236.     strcat(linkLine, tempStr);
  237. }
  238.  
  239. int ReadLibraries(f)
  240. char *f;
  241. /*Reads the libraries in file f into the link line.  Returns 1 iff successful,
  242.   0 otherwise*/
  243. {
  244.     FILE *inFile;
  245.     char *s, *t;
  246.     char libLine[MAXLINE + 1];
  247.  
  248.     inFile = fopen(f, "r");
  249.     if (inFile)
  250.     {
  251.     while (fgets(libLine, MAXLINE, inFile))
  252.     {
  253.         s = libLine;
  254.         while (*s && isspace(*s)) ++s;
  255.         if (*s && *s != '#')
  256.         {
  257.         /*Not a comment*/
  258.         t = s;
  259.         while (*t && !isspace(*t)) ++t;
  260.         *t = 0;
  261.         AppendLibrary(s);
  262.         }
  263.     }
  264.     close(inFile);
  265.     return 1;
  266.     }
  267.     else
  268.     {
  269.     return 0;
  270.     }
  271. }
  272.  
  273. void EmitLinks()
  274. /*Emits the link commands.  If it fails, blows up.*/
  275. {
  276.     FILE *outFile;
  277.  
  278.     /*Terminate links with a newline*/
  279.     strcat(linkLine, "\n");
  280.  
  281.     /*Emit them into the file*/
  282.     outFile = fopen(LINKMAKEFILE, "w");
  283.     if (!outFile)
  284.     {
  285.     perror(LINKMAKEFILE);
  286.     exit(-1);
  287.     }
  288.     PrintDontChangeScript(outFile);
  289.     fputs("#If you need to change something about the link path, do so in the link\n", outFile);
  290.     fputs("# file for  your machine.  You can get a list of those files by doing an\n", outFile);
  291.     fputs("#    ls lfiles.*.make\n", outFile);
  292.     fputs("# Then do make INSTALL again.\n", outFile); 
  293.     fputs("# If you need to link additional libraries, creat a file called lfiles.local\n", outFile);
  294.     fputs("# which contains one link file per line.\n\n", outFile);
  295.  
  296.     fprintf(outFile, "LFILES =\t");
  297.     fputs(linkLine, outFile);
  298.     fprintf(outFile, "\n");
  299.  
  300.     if (fortranP)
  301.     {
  302.     fprintf(outFile, "OBJFILES = $(COBJ) $(FOBJ)\n");
  303.     }
  304.     else
  305.     {
  306.     fprintf(outFile, "OBJFILES = $(COBJ)\n");
  307.     }
  308.     fclose(outFile);
  309. }
  310.  
  311. void FailAbort()
  312. /*Fails and aborts*/
  313. {
  314.     printf("After you have made the changes to 'machine.h,' please try 'make INSTALL'\n");
  315.     printf("once more.\n");
  316.     exit(-1);
  317. }
  318.  
  319. int YorNp()
  320. /*Asks for an answer to a yes-or-no question*/
  321. {
  322.     char *s, *t;
  323.     int k;
  324.  
  325.     fflush(stdout);
  326.  
  327.     for (;;)
  328.     {
  329.     if (curAnswer < nAnswers)
  330.     {
  331.         strcpy(curLine, answers[curAnswer]);
  332.         ++curAnswer;
  333.     }
  334.     else
  335. #if FGETS_IS_SO_STUPID
  336.     gets(curLine);
  337. #else
  338.     fgets(curLine, MAXLINE, stdin);
  339. #endif
  340.     s = curLine;
  341.     while (*s && isspace(*s)) ++s;
  342.     t = s;
  343.  
  344.     while (isalpha(*t)) *t++ = tolower(*t);
  345.     *t = 0;
  346.  
  347.     for (k = 0; k < NYESSTRINGS; ++k)
  348.     {
  349.         if (0 == strcmp(s, yesStrings[k]))
  350.         {
  351.         printf("\n");
  352.         return 1;
  353.         }
  354.     }
  355.     for (k = 0; k < NNOSTRINGS; ++k)
  356.     {
  357.         if (0 == strcmp(s, noStrings[k]))
  358.         {
  359.         printf("\n");
  360.         return 0;
  361.         }
  362.     }
  363.     printf("Please answer yes or no: ");
  364.     fflush(stdout);
  365.     }
  366. }
  367.  
  368. void GuessMachine()
  369. /*Guesses the machine type*/
  370. {
  371. #if MACHINE == IRIS4D
  372.     printf("Your computer appears to be a Silicon Graphics IRIS.\n");
  373. #else
  374. #if MACHINE == RS6000
  375.     printf("Your computer appears to be an IBM RISC computer.\n");
  376. #else
  377.     printf("The type of your computer could not be determined.  You will need to enter it\n");
  378.     printf("by hand.  Please edit the file 'machine.h' and look for the defined constant\n");
  379.     printf("MACHINE.\n\n");
  380.     FailAbort();
  381. #endif
  382. #endif
  383.     printf("Is this correct? ");
  384.     if (!YorNp())
  385.     {
  386.     printf("\nYou will need to enter the type of your computer by hand.  Please edit the\n");
  387.     printf("file 'machine.h' and look for the defined constant MACHINE.\n\n");
  388.     FailAbort();
  389.     }
  390. #if MACHINE == RS6000
  391.     Warning();
  392.     printf("Not all versions of the IBM RS/6000 support SciAn.  In order to run,\n");
  393.     printf("your system MUST have one of the graphics cards that support the GL library,\n");
  394.     printf("and it MUST be equipped with a Z-buffer.  If this is not the case, SciAn\n");
  395.     printf("will compile fine, but it will give an error when you try to run it.\n\n");
  396. #endif
  397. }
  398.  
  399. void FindMalloc()
  400. /*Finds the malloc library according to MALLOCH and appends the string to lfiles*/
  401. {
  402.     int found;
  403.     FILE *includeFile;
  404.  
  405.     /*See if the library can be found*/
  406.     found = (FindLib(LIBMALLOC) >= 0);
  407.  
  408.     if (found)
  409.     {
  410.     printf("The fast malloc library will be used.\n\n");
  411.     }
  412.     else
  413.     {
  414.     printf("The standard malloc library will be used.\n\n");
  415.     }
  416.  
  417.     if (found)
  418.     {
  419.     AppendLibrary(LIBMALLOC);
  420.     }
  421.  
  422.     includeFile = fopen("machine.malloc.h", "w");
  423.     if (!includeFile)
  424.     {
  425.     perror("machine.malloc.h");
  426.     exit(-1);
  427.     }
  428.  
  429.     PrintDontChangeC(includeFile);
  430.  
  431.     if (found)
  432.     {
  433.     fprintf(includeFile, "\n#define MALLOCH\n");
  434.     }
  435.     fclose(includeFile);
  436. }
  437.  
  438. void FindHDF()
  439. /*Finds the NCSA HDF library and appends the string to lfiles*/
  440. {
  441.     int found;
  442.     int foundVersion = 0;
  443.     int k;
  444.     FILE *includeFile;
  445.  
  446.     /*See if the library can be found*/
  447.     k = FindLib(LIBHDF);
  448.  
  449.     if (k >= 0)
  450.     {
  451.     FILE *temp;
  452.  
  453.     found = 1;
  454.  
  455.         /*Try to get the found version*/
  456.         sprintf(tempStr, "ar -t %s/lib%s.a > ./temp", libDir[k], LIBHDF);
  457.         if (system(tempStr) >= 0)
  458.         {
  459.         /*Now search file temp for the version*/
  460.         temp = fopen("temp", "r");
  461.         if (temp)
  462.         {
  463.             foundVersion = 0;
  464.             while (fgets(tempStr, MAXLINE, temp))
  465.             {
  466.             if (strstr(tempStr, "dfsdF.o"))
  467.             {
  468.                 foundVersion = MAX(foundVersion, 31);
  469.             }
  470.             if (strstr(tempStr, "vparse.o"))
  471.             {
  472.                 foundVersion = MAX(foundVersion, 32);
  473.             }
  474.             if (strstr(tempStr, "jcmaster.o"))
  475.             {
  476.                 foundVersion = MAX(foundVersion, 33);
  477.             }
  478.             }
  479.         }
  480.         else
  481.         {
  482.             foundVersion = 0;
  483.         }
  484.         }
  485.         else
  486.         {
  487.         foundVersion = 0;
  488.         }
  489.     }
  490.     else
  491.     {
  492.     found = 0;
  493.     }
  494.  
  495.     if (found)
  496.     {
  497.     printf("The NCSA HDF library has been located on your machine.  If you install\n");
  498.     printf("SciAn with this library, it will provide a useful file format.\n\n");
  499.  
  500.     if (!foundVersion)
  501.     {
  502.         Warning();
  503.         printf("SciAn has not been tested with the version of the HDF library installed\n");
  504.         printf("on your machine.  In all probability, it will work just fine, but there\n");
  505.         printf("is a small possibility you might get link errors.\n\n");
  506.     }
  507.  
  508.     printf("Do you want to install with the HDF library? ");
  509.  
  510.     found = YorNp();
  511.     }
  512.     else
  513.     {
  514.     Warning();
  515.     printf("The NCSA HDF library was not found on your machine and will not be linked\n");
  516.     printf("into SciAn.  You may want to consider getting the HDF library, as it\n");
  517.     printf("provides a useful file format.  It is available via anonymous ftp from\n");
  518.     printf("the fine folks at the National Center for Supercomputing Applications\n");
  519.     printf("at the University of Illinois at Champaign-Urbana (ftp.ncsa.uiuc.edu).\n");
  520.     printf("Install the HDF library in /usr/local/lib and MAKE INSTALL again.\n\n");
  521.     }
  522.  
  523.     includeFile = fopen("machine.hdf.h", "w");
  524.     if (!includeFile)
  525.     {
  526.     perror("machine.hdf.h");
  527.     exit(-1);
  528.     }
  529.  
  530.     PrintDontChangeC(includeFile);
  531.  
  532.     if (found)
  533.     {
  534.     fprintf(includeFile, "\n#define HDFDEF\n");
  535.     if (foundVersion == 31)
  536.     {
  537.         fprintf(includeFile, "#define HDF31\n");
  538.     }
  539.     else if (foundVersion == 32)
  540.     {
  541.         fprintf(includeFile, "#define HDF32\n");
  542.     }
  543.     else if (foundVersion == 33)
  544.     {
  545.         fprintf(includeFile, "#define HDF33\n");
  546.     }
  547.     }
  548.     fclose(includeFile);
  549.  
  550.     if (found)
  551.     {
  552.     AppendLibrary(LIBHDF);
  553.     }
  554. }
  555.  
  556. void FindNetCDF()
  557. /*Finds the NetCDF library appends the string to lfiles*/
  558. {
  559.     int k, l, m;
  560.     FILE *includeFile;
  561.     int found;
  562.  
  563.     /*See if the library can be found*/
  564.     k = FindLib(LIBNETCDF);
  565. #if MACHINE == IRIS4D
  566.     l = FindLib(LIBSUN);
  567. #else
  568.     l = 0;
  569. #endif
  570.     m = FindLib(LIBRPCSVC);
  571.  
  572.     found = 0;
  573.  
  574.     if (k < 0)
  575.     {
  576.     Warning();
  577.     printf("The NetCDF library was not found on your machine and will not be linked\n");
  578.     printf("into SciAn.  You may want to consider getting the NetCDF library, as it\n");
  579.     printf("provides a useful file reader.  This library is available via anonymous\n");
  580.     printf("ftp from unidata.ucar.edu.  Install the NetCDF library (libnetcdr.a) in\n");
  581.     printf("/usr/local/lib and MAKE INSTALL again.\n\n");
  582.     }
  583. #if MACHINE == IRIS4D
  584.     else if (l < 0)
  585.     {
  586.     Warning();
  587.     printf("The NetCDF library was found on your machine, but the sun library\n");
  588.     printf("(libsun.a) could not be found.  This library is required by netCDF when\n");
  589.     printf("linking on a Silicon Graphics computer.  NetCDF cannot be linked into\n");
  590.     printf("SciAn until the sun library is available.\n");
  591.     }
  592. #endif
  593.     else if (m < 0)
  594.     {
  595.     Warning();
  596.     printf("The NetCDF library was found on your machine, but the rpcsvc library\n");
  597.     printf("(librpcsvc.a) could not be found.  This library is required by netCDF when\n");
  598.     printf("linking on a Silicon Graphics computer.  NetCDF cannot be linked into\n");
  599.     printf("SciAn until the rpcsvc library is available.\n");
  600.     }
  601.     else
  602.     {
  603.     printf("The NetCDF library has been located on your machine.  If you install\n");
  604.     printf("SciAn with this library, it will provide a useful file reader.\n\n");
  605.  
  606.     printf("Do you want to install with the NetCDF library? ");
  607.  
  608.     found = YorNp();
  609.     }
  610.  
  611.     includeFile = fopen("machine.netcdf.h", "w");
  612.     if (!includeFile)
  613.     {
  614.     perror("machine.netcdf.h");
  615.     exit(-1);
  616.     }
  617.  
  618.     PrintDontChangeC(includeFile);
  619.  
  620.     if (found)
  621.     {
  622.     fprintf(includeFile, "\n#define NETCDFDEF\n");
  623.     }
  624.     fclose(includeFile);
  625.  
  626.     if (found)
  627.     {
  628.     AppendLibrary(LIBNETCDF);
  629. #if MACHINE == IRIS4D
  630.     AppendLibrary(LIBSUN);
  631. #endif
  632.     AppendLibrary(LIBRPCSVC);
  633.     }
  634. }
  635.  
  636. void FindJPEG()
  637. /*Finds the JPEG library according to HDFDEF and appends the string to lfiles*/
  638. {
  639.     int found;
  640.     int k;
  641.     FILE *includeFile;
  642.  
  643.     /*See if the library can be found*/
  644.     k = FindLib(LIBJPEG);
  645.  
  646.     if (k >= 0)
  647.     {
  648.     found = 1;
  649.     }
  650.     else
  651.     {
  652.     found = 0;
  653.     }
  654.  
  655.     if (found)
  656.     {
  657.     printf("The color JPEG library has been located on your machine.  If you install\n");
  658.     printf("SciAn with this library, it will provide a useful animation recorder driver.\n\n");
  659.  
  660.     printf("Do you want to install with the JPEG library? ");
  661.  
  662.     found = YorNp();
  663.     }
  664.     else
  665.     {
  666.     Warning();
  667.     printf("The color JPEG library was not found on your machine and will not be linked\n");
  668.     printf("into SciAn.  You may want to consider getting the JPEG library, as it\n");
  669.     printf("provides a useful animation recorder driver.  It was developed by Rodney\n");
  670.     printf("Hoinkes at the Centre for Landscape Research and is available via anonymous\n");
  671.     printf("ftp from uceng.uc.edu.  Install the JPEG library (libCLRjpeg4.a) in \n");
  672.     printf("/usr/local/lib and MAKE INSTALL again.\n\n");
  673.     }
  674.  
  675.     includeFile = fopen("machine.jpeg.h", "w");
  676.     if (!includeFile)
  677.     {
  678.     perror("machine.jpeg.h");
  679.     exit(-1);
  680.     }
  681.  
  682.     PrintDontChangeC(includeFile);
  683.  
  684.     if (found)
  685.     {
  686.     fprintf(includeFile, "\n#define JPEGRECORDER\n");
  687.     }
  688.     fclose(includeFile);
  689.  
  690.     if (found)
  691.     {
  692.     AppendLibrary(LIBJPEG);
  693.     }
  694. }
  695.  
  696. void FindFORTRAN()
  697. /*Finds FORTRAN*/
  698. {
  699.     int k;
  700.     FILE *includeFile;
  701.  
  702.     /*See if FORTRAN can be found*/
  703.     k = FindExe(f77Name);
  704.  
  705.     if (k)
  706.     {
  707.     printf("SciAn will be compiled using FORTRAN as well as C, which will give you\n");
  708.     printf("the entire PLOT-3D file reader.\n\n");
  709.     }
  710.     else
  711.     {
  712.     Warning();
  713.     printf("FORTRAN could not be found on your machine.  SciAn will compile without\n");
  714.     printf("it, but some features such as the PLOT-3D file reader which require FORTRAN\n");
  715.     printf("will not work fully.\n\n");
  716.     }
  717.  
  718.     includeFile = fopen("machine.fortran.h", "w");
  719.     if (!includeFile)
  720.     {
  721.     perror("machine.hdf.h");
  722.     exit(-1);
  723.     }
  724.  
  725.     PrintDontChangeC(includeFile);
  726.  
  727.     if (k)
  728.     {
  729.     fortranP = 1;
  730.     fprintf(includeFile, "\n#define FORTRAN\n");
  731. #if MACHINE == IRIS4D
  732.     ReadLibraries("flfiles.sgi4d.make");
  733. #else
  734. #if MACHINE == RS6000
  735.     ReadLibraries("flfiles.ibm6k.make");
  736. #endif
  737. #endif
  738.     }
  739.     fclose(includeFile);
  740. }
  741.  
  742. main(argc, argv)
  743. int argc;
  744. char *argv[];
  745. {
  746.     strcpy(f77Name, "f77");
  747.  
  748.     linkLine[0] = 0;
  749.  
  750.     nAnswers = argc - 1;
  751.     curAnswer = 0;
  752.     if (nAnswers)
  753.     {
  754.     answers = &(argv[1]);
  755.     }
  756.  
  757.     printf("\nScianPreInstall version 1.4 by Eric Pepke, 10 September 1993\n\n");
  758.     printf("The way SciAn will be compiled on your computer depends mostly on predefined\n");
  759.     printf("symbols and various flags defined in the 'machine.h' include file.  This\n");
  760.     printf("program determines whether 'machine.h' is consistent with the characteristics\n");
  761.     printf("of your computer and tells you what to do if they are not.\n\n");
  762.     printf("Please pay CAREFUL ATTENTION to the messages generated by this program.\n");
  763.     printf("Messages that begin with DANGER describe problems which will cause SciAn\n");
  764.     printf("not to compile or link properly.  Messages that begin with WARNING describe\n");
  765.     printf("possible problems that you must be aware of.\n\n");
  766.     
  767.     GuessMachine();
  768.     
  769.     if (!okSoFar)
  770.     {
  771.     FailAbort();
  772.     }
  773.  
  774.     FindMalloc();
  775.     
  776.     if (!okSoFar)
  777.     {
  778.     FailAbort();
  779.     }
  780.  
  781.     FindHDF();
  782.     
  783.     if (!okSoFar)
  784.     {
  785.     FailAbort();
  786.     }
  787.  
  788.     FindNetCDF();
  789.     
  790.     if (!okSoFar)
  791.     {
  792.     FailAbort();
  793.     }
  794.  
  795.     FindFORTRAN();
  796.     
  797.     if (!okSoFar)
  798.     {
  799.     FailAbort();
  800.     }
  801.  
  802.     FindJPEG();
  803.     
  804.     if (!okSoFar)
  805.     {
  806.     FailAbort();
  807.     }
  808.  
  809.     CopyCFile("machine.local.h", "machine.extras.h");
  810.  
  811. #if MACHINE == RS6000
  812.     if (!ReadLibraries("lfiles.ibm6k.make"))
  813.     {
  814.     perror("lfiles.ibm6k.make");
  815.     }
  816.     ReadLibraries("lfiles.local");
  817.     CopyScriptFile("flags.ibm6k.make", "flags.make");
  818. #else
  819. #if MACHINE == IRIS4D
  820.     if (!ReadLibraries("lfiles.sgi4d.make"))
  821.     {
  822.     perror("lfiles.sgi4d.make");
  823.     }
  824.     ReadLibraries("lfiles.local");
  825.     CopyScriptFile("flags.sgi4d.make", "flags.make");
  826. #endif
  827. #endif
  828.     EmitLinks();
  829.  
  830.     if (warnings)
  831.     {
  832.     printf("The pre-installation process produced %d warning message%s.  Please read the\n", warnings, warnings == 1 ? "" : "s");
  833.     printf("message%s to see if %s to your case.  You can try to compile SciAn\n", warnings == 1 ? "" : "s", warnings == 1 ? "it applies" : "they apply");
  834.     printf("in spite of the warning%s by entering 'make scian' now.\n\n", warnings == 1 ? "" : "s");
  835.     }
  836.     else
  837.     {
  838.     printf("The link commands should now be set up properly.  To make SciAn, enter\n");
  839.     printf("make scian\n\n");
  840.     }
  841.  
  842. #if MACHINE == IRIS4D
  843.     printf("If you have more than one processor on your computer, use pmake\n");
  844.     printf("instead of make to speed things up.\n\n");
  845. #endif
  846.     exit(0);
  847. }
  848.